import request from '@/utils/request'

// 密码加密配置相关接口
export function getAuthConfigList(params) {
  return request({
    url: '/basic/web/auth_key/config/list',
    method: 'get',
    params
  })
}

export function getAuthConfigDetail(id) {
  return request({
    url: `/basic/web/auth_key/config/${id}`,
    method: 'get'
  })
}

export function addAuthConfig(data) {
  return request({
    url: '/basic/web/auth_key/config',
    method: 'post',
    data
  })
}

export function updateAuthConfig(data) {
  return request({
    url: '/basic/web/auth_key/config',
    method: 'put',
    data
  })
}

export function deleteAuthConfig(ids) {
  return request({
    url: `/basic/web/auth_key/config/${ids}`,
    method: 'delete'
  })
}

// 客户端授权相关接口
export function getAuthClientList(params) {
  return request({
    url: '/basic/web/authclient/list',
    method: 'get',
    params
  })
}

export function getAuthClientDetail(clientId) {
  return request({
    url: `/basic/web/authclient/${clientId}`,
    method: 'get'
  })
}

export function addAuthClient(data) {
  return request({
    url: '/basic/web/authclient',
    method: 'post',
    data
  })
}

export function updateAuthClient(data) {
  return request({
    url: '/basic/web/authclient',
    method: 'put',
    data
  })
}

export function deleteAuthClient(clientIds) {
  return request({
    url: `/basic/web/authclient/${clientIds}`,
    method: 'delete'
  })
}

// 验证码配置相关接口
export function getCaptchaEncryptAlgList() {
  return request({
    url: '/basic/web/auth/captcha/encryptAlgList',
    method: 'get'
  })
}

export function getCaptchaDetail() {
  return request({
    url: '/basic/web/auth/captcha/detail',
    method: 'get'
  })
}

export function updateCaptchaConfig(data) {
  return request({
    url: '/basic/web/auth/captcha',
    method: 'put',
    data
  })
}

// 令牌刷新机制配置相关接口
export function getTokenConfigDetail() {
  return request({
    url: '/basic/web/auth_token/config/detail',
    method: 'get'
  })
}

export function updateTokenConfig(data) {
  return request({
    url: '/basic/web/auth_token/config',
    method: 'put',
    data
  })
}